package cn.xp.feign;

import cn.xp.dto.FloorDto;
import cn.xp.fallback.DeviceFeignClientFallbackFactory;
import cn.xp.util.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Description feign请求device服务的客户端
 * @Author xp
 * @Date 2023/4/14 11:45
 * @Version 1.0
 */
@FeignClient(value = "device-service",fallbackFactory = DeviceFeignClientFallbackFactory.class) // 表示是feign接口")//想调用那个接口的服务名,根据服务名找接口
public interface DeviceFeignClient {

    //调用的接口需要和被调用的接口的请求方式、请求参数、请求地址、返回值类型保持一致
    @GetMapping("/api/device/getDeviceInfoById/{id}")
    public JSONResult<FloorDto> getDeviceInfoById(@PathVariable("id") Long id);
}